package com.angel.mocks.data.generator.dataGenerator;

import java.io.FileNotFoundException;
import java.io.InputStream;

import com.angel.architecture.persistence.beans.Country;
import com.angel.data.generator.annotations.Generator;
import com.angel.data.generator.annotations.importFileProcessorRunner.ImportFileProcessorRunnerBuilder;
import com.angel.data.generator.annotations.inputStream.InputStreamBuilder;
import com.angel.data.generator.exceptions.DataGeneratorException;
import com.angel.io.descriptor.FileProcessorDescriptor;
import com.angel.io.processors.commands.impl.ExcelFileProcessorCommand;
import com.angel.io.processors.runners.imports.impl.ImportFileAnnotationProcessorRunner;
import com.angel.io.processors.runners.imports.impl.ImportFileProcessorRunner;
import com.angel.mocks.io.resourceLocation.ResourceLocation;
import com.angel.mocks.io.rowProcessorCommands.CountryInvalidColumnRowTypeAnnotationRowProcessorCommand;

/**
 *
 * @author William
 */
@Generator(
		objectClass = Country.class,
		dependencies = {},
		daoName = "countryDAO",
		pages = {1}
)
public class CountryInvalidRowColumnAnnotationDataGenerator {

	@ImportFileProcessorRunnerBuilder(fileProcessorDescriptor = FileProcessorDescriptor.class, name = "Countries Import")
    public ImportFileProcessorRunner prepareImportFileProcessorRunner(FileProcessorDescriptor fileProcessorDescriptor) {
        return new ImportFileAnnotationProcessorRunner(fileProcessorDescriptor, new ExcelFileProcessorCommand(), new CountryInvalidColumnRowTypeAnnotationRowProcessorCommand());
    }

    @InputStreamBuilder
    public InputStream prepareInputStream() {
        try {
            return ResourceLocation.findInputStreamFor(ResourceLocation.COUNTRIES_XLS_RESOURCE);
        } catch (FileNotFoundException e) {
            throw new DataGeneratorException("File not found [" + ResourceLocation.COUNTRIES_XLS_RESOURCE + "].", e);
        }
    }
}